package com.simple.crawler.core;

import java.util.HashMap;
import java.util.Map;

public class  CrawlerCache extends HashMap<String, Map<String, Object>> {

    public void put(String taskId, String key, Object  value) {
        if (!this.containsKey(taskId)) {
            this.put(taskId, new HashMap<>());
        }
        this.get(taskId).put(key, value);
    }

    public <T> T get(String taskId, String key, Class<T> c) {
        if (!this.containsKey(taskId)) {
            return null;
        }
        return (T) this.get(taskId).get(key);
    }

}
